#include <stdio.h>
#include <math.h>
#include <gsl/gsl_integration.h>



class Integrate{
	public:
		Integrate(double err)
		{
			_err=err;
			_w= gsl_integration_workspace_alloc (10000);
	       	}
		~Integrate(void)
		{
			gsl_integration_workspace_free (_w);
		}
		double operator()(double a, double b, double (*func)(double, void*),double *alpha)
		{
			gsl_function F;
			F.function = func;
              		F.params = alpha;
			gsl_integration_qags(&F, a, b, 0, _err, 10000,_w, &_result, &_app); 
			return _result;
		}
	private:
		double _err;
		double _result;
		double _app;
		gsl_integration_workspace *_w; 
};
